package com.shigen.demo.exception;

import com.shigen.demo.Enum.HttpStatusCode;

public class BusinessException extends RuntimeException {

  protected Integer code;
  protected String label;
  protected String stackMsg;

  public BusinessException() {
    this.code = HttpStatusCode.INTERNAL_SERVER_ERROR.getCode();
    this.label = HttpStatusCode.INTERNAL_SERVER_ERROR.getZhMessage();
  }

  public BusinessException(HttpStatusCode httpStatusCode) {
    super(httpStatusCode.getZhMessage());
    this.code = httpStatusCode.getCode();
    this.label = httpStatusCode.getZhMessage();
  }

  public BusinessException(HttpStatusCode httpStatusCode, String message) {
    super(message);
    this.code = httpStatusCode.getCode();
    this.label = httpStatusCode.getZhMessage();
  }

  public BusinessException(String message) {
    super(message);
    this.code = HttpStatusCode.INTERNAL_SERVER_ERROR.getCode();
    this.label = HttpStatusCode.INTERNAL_SERVER_ERROR.getZhMessage();
  }

  public BusinessException(String message, Throwable cause) {
    super(message, cause);
    this.code = HttpStatusCode.INTERNAL_SERVER_ERROR.getCode();
    this.label = HttpStatusCode.INTERNAL_SERVER_ERROR.getZhMessage();
  }

  public BusinessException(Throwable cause) {
    super(cause);
    this.code = HttpStatusCode.INTERNAL_SERVER_ERROR.getCode();
    this.label = HttpStatusCode.INTERNAL_SERVER_ERROR.getZhMessage();
  }

  public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
    super(message, cause, enableSuppression, writableStackTrace);
    this.code = HttpStatusCode.INTERNAL_SERVER_ERROR.getCode();
    this.label = HttpStatusCode.INTERNAL_SERVER_ERROR.getZhMessage();
  }

  public Integer getCode() {
    return code;
  }

  public void setCode(Integer code) {
    this.code = code;
  }

  public String getLabel() {
    return label;
  }

  public void setLabel(String label) {
    this.label = label;
  }

  public String getStackMsg() {
    return stackMsg;
  }

  public void setStackMsg(String stackMsg) {
    this.stackMsg = stackMsg;
  }
}
